import requests
import pytest
from api.ihrm_login_api import IhrmLogin
from common.assert_ihrm import assert_delete
from data.ihrm_login_data import add_data


class IhrmDel:
    @classmethod
    def ihrm_del(self, id):
        # 准备登录 请求体

        req_body_l = {"mobile": "13800000002", "password": "123456"}
        # 调用接口层的 登录请求类的方法 参数中传递请求体 获取响应数据
        res = IhrmLogin.login_Ok(req_body_l)
        token = "Bearer " + res.json()["data"]
        # 准备删除员工行头体
        req_url = f"http://ihrm-test.itheima.net/api/sys/user/{id}"
        req_head = {"Authorization": token}

        res = requests.post(url=req_url)
        print("响应数据==", res)

        assert_delete(200, True, 10000, "成功")
